<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>switch</title>
</head>
<body>
<script>
    str='tom';
    switch (str) {
        case "tiger":
            alert('tiger');
            break;
        case "tom":
            alert("tome");
            break;
        case "tiger01":
            alert("tiger01");
            break;
        default:
            alert("匹配失败")
    }
</script>
</body>
</html>